package unimelb.discussiontracker.twitter.data.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "TopicIntervalAssociation")
@NamedQueries(value = {
        @NamedQuery(name = "TopicIntervalAssociation.FindByTopicId", query = "SELECT association FROM TopicIntervalAssociation association JOIN FETCH association.interval JOIN FETCH association.topic WHERE association.topic.id = :topicId ORDER BY association.id ASC"),
        @NamedQuery(name = "TopicIntervalAssociation.FindByTopicIdAndIntervalId", query = "SELECT association FROM TopicIntervalAssociation association JOIN FETCH association.interval JOIN FETCH association.topic WHERE association.topic.id = :topicId AND association.interval.id = :intervalId") })
public class TopicIntervalAssociation {

    @Id
    @GeneratedValue
    @Column(name = "Id")
    private long id;

    @ManyToOne
    @JoinColumn(name = "TopicId")
    private TopicEntity topic;

    @ManyToOne
    @JoinColumn(name = "IntervalId")
    private IntervalEntity interval;

    private int sentiment;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public TopicEntity getTopic() {
        return topic;
    }

    public void setTopic(TopicEntity topic) {
        this.topic = topic;
    }

    public IntervalEntity getInterval() {
        return interval;
    }

    public void setInterval(IntervalEntity interval) {
        this.interval = interval;
    }

    public int getSentiment() {
        return sentiment;
    }

    public void setSentiment(int sentiment) {
        this.sentiment = sentiment;
    }

}
